package GameLogic
{
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	import SoundManager.SoundFactory;
	public class InfoShow extends Sprite
	{
		public var Check:Boolean;
		private var a_bmp:Bitmap;
		private var b_bmp:Bitmap;
		private var c_bmp:Bitmap;
		public function InfoShow(_a:BitmapData,_b:BitmapData,_c:BitmapData,_defaultState:Boolean)
		{
			c_bmp = new Bitmap(_c);
			c_bmp.x = -155;
			a_bmp = new Bitmap(_a);
			b_bmp = new Bitmap(_b);
			addChild(a_bmp);
			addChild(b_bmp);
			addChild(c_bmp);
			Check = _defaultState;	
			
			this.addEventListener(MouseEvent.CLICK, function(e:Event):void
			{
				SoundFactory.Sounds["button2"].play();
				Game.RemoveTooltip();
				Check = !Check;
				if (Check)
				{
					a_bmp.visible = true;
					b_bmp.visible = false;
					Game.LuaEdit.visible = true;
					Game.InitShowRadar = Game.SetButton.SettingPanel.radar.selected;
					Game.SetButton.SettingPanel.radar.selected = false;
				}
				else
				{
					a_bmp.visible = false;
					b_bmp.visible = true;
					Game.LuaEdit.visible = false;
					Game.SetButton.SettingPanel.radar.selected = Game.InitShowRadar;
				}
			});
			this.addEventListener(MouseEvent.MOUSE_OVER, function(e:Event):void
			{
				Mouse.cursor = MouseCursor.BUTTON;
				if(!Game.LuaEdit.visible)
				   AddTooltip();
			});
			this.addEventListener(MouseEvent.MOUSE_OUT, function(e:Event):void
			{
				Mouse.cursor = MouseCursor.AUTO;
				Game.RemoveTooltip();
			});
		}
		
		public function ConsistentIco():void
		{
			if (Check)
				{
					a_bmp.visible = true;
					b_bmp.visible = false;
				}
				else
				{
					a_bmp.visible = false;
					b_bmp.visible = true;
				}
		}
		
		private function AddTooltip():void
		{
			Game.AddTooltip(this, a_bmp, "打开游戏脚本编辑器.", -80, -25);
		}
	}
}